<?php

namespace Admin\Controller;

use Think\Controller;

class UserController extends Controller
{
    //显示user表列表及删除
    public function index()
    {
        $info = M('user')->field('id,username,email,addtime,sm_is_ok')->select();

        $this->ajaxReturn($info, 'JSON');
    }


    public function upshiming($status, $userid)
    {
        if ($status != NULL && $userid != NULL) {
            if (M('User')->where(array(
                'id' => $userid
            ))->setField('sm_is_ok', $status)
            ) {
                $this->ajaxSuccess('编辑成功！');
            } else {
                $this->ajaxError('编辑失败！');
            }
        }
        $this->ajaxError('编辑失败！');
    }
}